<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const p = new Promise((resolve,reject)=>{
            console.log('请求获取A数据');
            try {
                throw new Error('请求网络出现问题')
                setTimeout(() => {
                    console.log('A数据获取成功');
                    resolve('成功')
                }, 1000);
            } catch (e) {
                //catch接收的e就是错误对象
                console.log(e);
                //e身上有个message的属性,记录的就是错误信息
                console.log(e.message);
                reject(e.message)
            }
        })
        console.log('p',p);
    </script>
</body>
</html>